<template>
    <div class="CateSelect">
        <el-select
            v-model="cate"
            clearable
            placeholder="请选择品类"
            @change="$emit('change',$event)"
            >
            <el-option
                v-for="item in cateList"
                :key="item.id"
                :label="item.cate_zh"
                :value="item.cate">
            </el-option>
        </el-select>
    </div>
</template>
<script>
import {mapState,mapActions} from 'vuex'
export default {
   data() {
      return {
          
      }
   },
   props:{
       value:{type:String,required:false,default:''}
   },
   created(){
       this.getCateList()
   },
   computed:{
       ...mapState('good',['cateList']),
       cate:{
           get(){
               console.log(this.value);
               return this.value
           },
           set(newCate){
               return this.$emit('input',newCate)
           }
       }
   },
   methods:{
       //调获取品类的接口
       ...mapActions('good',['getCateList']),
   },
}
</script>
<style lang="scss" scoped>

</style>
